Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape angle brackets in configuration #9189

Merged
merged 5 commits into from
Nov 21, 2019
Merged

Conversation

ayush000
Copy link
Contributor

Summary

If you open Jest configuration page and click on moduleDirectories [array], the respective section doesn't open up.

This is because github markdown treats anything within angle brackets as an HTML tag. Due to this, data types such as [array<string>] get rendered as [array]. Many of the links are broken because docusaurus doesn't read the hidden HTML tag.

HTML tags can be escaped by prepending them with a backslash

Github markdown treats anything within angle brackets as an HTML tag. Due to this, data types such as `[array\<string>]` get rendered as `[array<string>]`. Many of the links are broken because of this because docusaurus doesn't read the hidden HTML tag.
@facebook-github-bot
Copy link
Contributor

Hi ayush000! Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file.In order for us to review and merge your code, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@codecov-io
Copy link

codecov-io commented Nov 15, 2019

Codecov Report

Merging #9189 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9189      +/-   ##
==========================================
- Coverage    65.1%   65.09%   -0.02%     
==========================================
  Files         278      278              
  Lines       11860    11860              
  Branches     2922     2921       -1     
==========================================
- Hits         7722     7720       -2     
- Misses       3510     3511       +1     
- Partials      628      629       +1
Impacted Files Coverage Δ
packages/expect/src/utils.ts 94.93% <0%> (-1.27%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d4e2d84...b21b990. Read the comment docs.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Could you fix the versioned docs as well?
image

@ayush000
Copy link
Contributor Author

Done @SimenB . I wanted to ensure that the links generated by docusaurus on the Configuration page are working now. Is there a way to do that?

@SimenB
Copy link
Member

SimenB commented Nov 17, 2019

You can run yarn start in the website/ directory

@ayush000
Copy link
Contributor Author

ayush000 commented Nov 17, 2019

@SimenB Links are still not working. It seems to be bug in Docusaurus. I've filed a bug report on its repo.

@SimenB
Copy link
Member

SimenB commented Nov 17, 2019

There's also a netlify deployment: https://deploy-preview-9189--jest-preview.netlify.com/

Thanks for reporting upstream!

@ayush000
Copy link
Contributor Author

Docusaurus fixed the issue with link generation (PR here). I tested master branch of docusaurus locally. The config links are generated correctly in Table of Contents and in Navigation Sidebar.

But I noticed that the Navigation sidebar is still showing [array] in place of [array<string>].

image

I filed another issue on docusaurus's repo.

@SimenB
Copy link
Member

SimenB commented Nov 20, 2019

Super cool, thanks for following up!

@ayush000
Copy link
Contributor Author

ayush000 commented Nov 21, 2019

But I noticed that the Navigation sidebar is still showing [array] in place of [array<string>].

To fix the Navigation sidebar rendering, the docusaurus team suggested replacing < and > with &lt; and &gt; respectively. I tested that it fixes the sidebar rendering.

If docusaurus doesn't fix rendering of angle brackets in their next release, should I replace all angle brackets with &lt; and &gt;?

@endiliey
Copy link
Contributor

endiliey commented Nov 21, 2019

Maybe better to close this PR. Its an upstream bug in Docusaurus which is fixed in next release. Someone should've pinged me 😆

@SimenB
Copy link
Member

SimenB commented Nov 21, 2019

Is it fixed in a release now? If so, maybe this pr can be changed to bumping the version instead?

@endiliey
Copy link
Contributor

@SimenB
Copy link
Member

SimenB commented Nov 21, 2019

Wonderful, thank you! @ayush000 could you remove the md changes and update the version instead? 🙂

@ayush000
Copy link
Contributor Author

We still need to escape angle brackets. The links get fixed by docusaurus version bump, but it still doesn't render [array<string>] unless you escape the angle brackets. This is the correct behaviour in my opinion because github markdown treats anything within angle brackets as an HTML tag.

E.g.

[array<string>] gets rendered as [array]
[array\<string>] gets rendered as [array<string>]

@endiliey
Copy link
Contributor

endiliey commented Nov 21, 2019

Oh you are right. The bug in docusaurus is that the rendered markdown content, autogenerated toc and sidebar isn't consistent (but its consistent now)

* master:
  chore: upgrade to fsevents 2 (jestjs#9215)
  docs: remove expect.assertions(1) in rejects example of Tutoria… (jestjs#9149)
  chore: bump to istanbul alphas (jestjs#9192)
  Fix typo in JestPlatform.md (jestjs#9212)
  jest-snapshot: Ignore indentation for most serialized objects (jestjs#9203)
  fix(jest-types): tighten Config types and set more defaults (jestjs#9200)
  jest-snapshot: Improve colors when snapshots are updatable (jestjs#9132)
  jest-snapshot: Omit irrelevant received properties when property matchers fail (jestjs#9198)
  chore: make changedFiles option optional in `shouldInstrument` (jestjs#9197)
  fix(pretty-format): correctly detect memo (jestjs#9196)
  chore: regenerate lockfiles in e2e tests (jestjs#9193)
  chore: bump handlebars
@SimenB SimenB merged commit 670f83e into jestjs:master Nov 21, 2019
@SimenB
Copy link
Member

SimenB commented Nov 21, 2019

Thank you so much @ayush000, this is wonderful!

@ayush000 ayush000 deleted the patch-1 branch November 21, 2019 16:53
@SimenB
Copy link
Member

SimenB commented Nov 21, 2019

@endiliey while you're here, the "read more" buttons on the blog are broken: https://jestjs.io/blog/. Known?

@endiliey
Copy link
Contributor

interesting bug. can you help file an issue ? didnt know about it. We never really changed anything on that part though 😅. Is it working on 1.14 previously ? Its midnight here and am not within reach of pc

I suspect css from facebook/docusaurus#1869 blocked that ??

cc @yangshun read more is broken :o

@SimenB
Copy link
Member

SimenB commented Nov 21, 2019

I don't know when it broke, @pedrottimark alerted me to it now

@yangshun
Copy link
Contributor

Please click on the post title for now. We'll push out a hotfix.

@endiliey
Copy link
Contributor

endiliey commented Nov 22, 2019

@SimenB update to 1.14.2. Yeah its regression from 1.14.1. 1.14.0 was working fine. My suspicion was right, facebook/docusaurus#1869 broke it

@SimenB
Copy link
Member

SimenB commented Nov 22, 2019

Updated in f4d0565, and I can confirm it fixes the issue. Thanks, as always, for the help! 🙂

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants